<div class="bjui-pageHeader">
    <form id="pagerForm" data-toggle="ajaxsearch" action="${request.getContextPath()}/HtfcOutInspect/htfcOutInspect" method="post">
        <div class="bjui-searchBar">
            <g:hiddenField name="SYS_QUERY_NAME" value="htfcOutInspect" />
            <g:hiddenField name="EXPORT_CONTENT_NAME" value="Excel" />
            <label >产品编码：</label>&nbsp;
            <input type="text" name="partName"  value="${partName}"/>
            <label >图号：</label>&nbsp;
            <input type="text" name="tuhao" value="${tuhao}"/>
            <label >订单号：</label>&nbsp;
            <input type="text" name="partentId" value="${partentId}"/>
            <label >外协单位：</label>&nbsp;
            <input type="text" name="UNIT" value="${UNIT}"/>
            <label >批次号：</label>&nbsp;
            <input type="text" name="lotId" value="${lotId}"/>
            <label >时间段：</label>&nbsp;
            <input type="text" name="startTime" value="${startTime}" data-pattern="yyyy/MM/dd"  data-toggle="datepicker" placeholder="FROM">
            <input type="text" name="endTime" value="${endTime}" data-pattern="yyyy/MM/dd" data-toggle="datepicker" placeholder="TO">&nbsp;&nbsp;
            <button type="submit" class="btn-default" data-icon="search">查询</button>&nbsp;
            <button type="button" class="btn-blue" onclick="javascript:bjuiExportExl('#pagerForm','${request.getContextPath()}/OutsourcedProcessing/exportExcel')" data-icon="file-excel-o" title="导出Excel">导出</button>&nbsp;
        </div>
    </form>
</div>

<div class="bjui-pageContent">
    <g:if test="${htfcOutInspect.size() > 0}">
        <table  data-toggle="tablefixed" data-width="100%" data-nowrap="true">
            <thead>
            <tr id="t1">
                <g:each in="${tableHeadList}" status="j" var="headInstance">
                    <g:if test="${headInstance!='RN'}">
                        <th  width="125"><g:message code="${headInstance}" default="${headInstance}"/></th>
                    </g:if>
                </g:each>
            </tr>
            </thead>
            <tbody>
            <g:if test="${htfcOutInspect.size()>0}">
                <g:each in="${htfcOutInspect}" status="i" var="dataInstance">
                    <tr>
                        <g:each in="${tableHeadList}" status="j" var="headInstance">
                            <g:if test="${headInstance=='CKECKOUT_QTY'}">
                                <td name="CKECKOUT${i}">${dataInstance["${headInstance}"]}</td>
                            </g:if>
                            <g:elseif test="${headInstance=='QUALIFIED_QTY'}">
                                <td name="QUALIFIED${i}">${dataInstance["${headInstance}"]}</td>
                            </g:elseif>
                            <g:elseif test="${headInstance=='UNQUALIFIED_QTY'}">
                                <td name="UNQUALIFIED${i}">${dataInstance["${headInstance}"] }</td>
                            </g:elseif>
                            <g:elseif test="${headInstance!='RN'}">
                                <td>${dataInstance["${headInstance}"]}</td>
                            </g:elseif>

                        </g:each>
                    </tr>
                </g:each>
                <tr>
                    <td colspan="8">小计</td>
                    <td name="CKECKOUTSHOW"></td>
                    <td name="QUALIFIEDSHOW"></td>
                    <td name="UNQUALIFIEDSHOW"></td>

                </tr>
                <tr>
                    <td colspan="8">合计</td>
                    <td>${htfcOutInspectSumQty.SUM_CKECKOUT[0]}</td>
                    <td>${htfcOutInspectSumQty.SUM_QUALIFIED[0]}</td>
                    <td>${htfcOutInspectSumQty.SUM_UNQUALIFIED[0]}</td>
                </tr>

            </g:if>
            <g:else>
                <g:render template="../template/emptyPanel" />
            </g:else>
            </tbody>
        </table>
    </g:if>
</div>
<g:render template="../template/pagination" />
<script>
    $(function(){
        var checkOutQty=0;
        var qualifiedQty=0;
        var unqualifiedQty=0;
        for(var i=0;i<${htfcOutInspect.size()};i++){

            var checkOut='CKECKOUT'+i
            var checkOutAdd=$("td[name='"+checkOut+"']").text()==''?0:parseInt($("td[name='"+checkOut+"']").text());
            checkOutQty+=checkOutAdd;

            var qualified='QUALIFIED'+i
            var qualifiedAdd=$("td[name='"+qualified+"']").text()==''?0:parseInt($("td[name='"+qualified+"']").text());
            qualifiedQty+=qualifiedAdd;

            var unqualified='UNQUALIFIED'+i
            var unqualifiedAdd=$("td[name='"+unqualified+"']").text()==''?0:parseInt($("td[name='"+unqualified+"']").text());
            unqualifiedQty+=unqualifiedAdd;
        }

        $("td[name='CKECKOUTSHOW']").html(checkOutQty);
        $("td[name='QUALIFIEDSHOW']").html(qualifiedQty);
        $("td[name='UNQUALIFIEDSHOW']").html(unqualifiedQty);


    })
</script>
